package Administrator.Login.AdministratorLoginController;

import Administrator.Login.AdministratorLoginView.*;
import Administrator.Login.AdministratorLoginModel.*;
import Administrator.AdministratorMainFrame.AdministratorMainFrameView.*;
import Administrator.AdministratorMainFrame.AdministratorMainFrameModel.*;
import Administrator.AdministratorMainFrame.AdministratorMainFrameController.*;

public class AdministratorLoginController 
{
	 public void initialize()
	 {
		 getView().exitButton.addActionListener(new ExitButtonListener(getView(), getModel()));
		 getView().loadFileButton.addActionListener(new LoadFileButtonListener(getView(), getModel()));
		 getView().loginButton.addActionListener(new LoginButtonListener(getView(), getModel(), this));
	 }
	 public void setViewAndModel(AdministratorLoginView view, AdministratorLoginModel model)
	 {
	     this.view = view;
	     this.model = model;
	 }
	 public AdministratorLoginView getView()
	 {
		 return this.view;
	 }
	 public AdministratorLoginModel getModel()
	 {
		 return this.model;
	 }
	 
	 public void runMainFrame()
	 {
		 getView().frame.setVisible(false);
		 AdministratorMainFrameView view = new AdministratorMainFrameView();
		 AdministratorMainFrameModel model = new AdministratorMainFrameModel();
		 AdministratorMainFrameController controller = new AdministratorMainFrameController();
		 model.setViewAndController(view, controller);
		 controller.setViewAndModel(view, model);
		 model.initialize(this.getModel());
		 controller.initialize();
	 }
	 
	 private AdministratorLoginView view;
	 private AdministratorLoginModel model;
}
